<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base target="_self" />
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">

<title>修改密码</title>

<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/default/easyui.css"/>">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/icon.css"/>">
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/jquery-1.6.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.panel.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.datagrid.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.messager.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/ext-for-framework.js.jsp"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/locale/easyui-lang-zh_CN.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/js/json2.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/js/common.js"/>"></script>
<script type="text/javascript">
	function changePassword() {
		if ( $("#password")[0].value == $("#password2")[0].value ) {
			savepassword();
		} else {
			alert("两次密码输入不一致！");
			return false;
		}
	}
	function form_onkeyup() {
		key = window.event.keyCode;
		if (key == 0xD)//判断是否按下回车键
		{
			changePassword();
		}
	}
	//添加信息按钮响应函数
	function savepassword() {
		$('#saveForm').form('submit', {
			url : '<c:url value='/user/changePassword.do'/>', 
			onSubmit : function()//提交按钮相应函数
			{
				return $('#saveForm').form('validate');
			},
			success : function(data) {
				data = eval('(' + data + ')');
				var msgsuccess = data.success + "";
				if (data.success) {
					$.messager.alert('系统提示', '保存成功', 'info', function(){
						window.close();
					});
				} else {
					$.messager.alert("提示", '保存失败', 'warning');
				}
			},
			error : function() {
				$.messager.alert("错误", "系统错误，请联系管理员！", 'error');
				return;
			}
		});

	}
</script>
</head>

<body>
	<table width="90%" align="center">
		<tr></tr>
		<tr>
			<td>

				<div style="height: auto; background: #fafafa; padding: 5px;"
					class="easyui-panel" title="更改密码" iconCls="icon-save"
					collapsible="true" minimizable="false" maximizable="false"
					closable="false">

					<form id="saveForm" name="saveForm" method="post">
						<table cellpadding="5">
							<tr>
								<td>新密码:</td>
								<td><input class="easyui-validatebox" type="password" id="password" name="password" data-options="required:true" />
								</td>
							</tr>
							<tr>
								<td>确认密码：</td>
								<td><input class="easyui-validatebox" type="password" id="password2" name="password2" data-options="required:true" />
								</td>
							</tr>
							<tr>
								<td><input class="easyui-validatebox" type="hidden" name="userId" id="userId"  value="${userVo.userId }" /></td>
							</tr>
							<tr>
								<td><a href="#" class="easyui-linkbutton" onclick="changePassword()">确认</a></td>
							</tr>
						</table>
						
					</form>
				</div>
			</td>
		</tr>
	</table>
</body>
</html>
